$('#SaveRule').on('click', function () {
    var ruleStr = "";
    $("input[type='checkbox'][name='ruleDic']:checked").each(function () {
        //  选中复选框中的值
        ruleStr += $(this).val() + ",";
    });
    ruleStr = ruleStr.substring(0, ruleStr.length - 1)
    var resume = $('#RuleResume').val();
    if ((ruleStr.length == 0) && (resume.length == 0)) {
        $.messager.alert("错误提示", "请选择排除原因或者填写备注!", 'error');
    } else {
        var reEnrollAx = new $ax("/sds/sdsqcformshow/reEnroll", function (data) {
            if (data!="") {
                $.messager.popover({
                    msg: "该患者已自动入组新病种【"+data+"】",
                    type: 'info',
                    timeout: 3000, 		//0不自动关闭。3000s
                    showSpeed: 'slow', //fast,slow,normal,1500
                    showType: 'fade'  //show,fade,slide
                });
            }
        });
        reEnrollAx.set('mrListId', $("#mrListId").val());
        //提交信息
        var ajax = new $ax("/sds/sdsqcformshow/changeMrStatus", function (data) {
            parent.postMessage("save", "*");
            reEnrollAx.start();
            // 等待3000ms（3秒）后执行下面这段代码
            setTimeout(function() {
                parent.layer.close(parent.layer.getFrameIndex(window.name)); //先得到当前iframe层的索引,再执行关闭
            }, 3000);
        }, function (data) {
            $.messager.alert("错误提示", "状态更新错误!", 'info');
        });
        ajax.set('mrListId', $("#mrListId").val());
        ajax.set('status', "O");
        ajax.set('execUser', $("#execUser").val())
        ajax.set('reason', ruleStr);
        ajax.set('resume', resume);
        ajax.start();
    }
});